<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="layout/default">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>编辑权限</title>
<link rel="stylesheet" th:href="@{/css/bootstrap-switch.min.css}" />
<script type="text/javascript" th:src="@{/js/bootstrap-switch.min.js}"></script>
<script>
	$(document).ready(function() {
		$('input:checkbox').bootstrapSwitch();
	});
</script>
</head>
<body>
	<div layout:fragment="content">
		<form class="form-horizontal" action="" method="POST"
			th:action="@{/permissions/save}" th:object="${authPermission}">
			<fieldset>
				<legend>编辑权限</legend>
				<input type="hidden" id="action" name="action" value="update" /> <input
					type="hidden" th:field="*{permissionId}" />
				<div class="form-group"
					th:classappend="${#fields.hasErrors('permissionName')} ? 'has-error'">
					<label for="permissionName"
						class="col-lg-2 col-md-2 col-sm-2 hidden-xs control-label">权限名称</label>
					<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12">
						<input type="text" class="form-control input-sm"
							th:field="*{permissionName}" maxLength="64" required="required"
							requireText="请输入权限名称" placeHolder="权限名称" autofocus="autofocus" />
						<small class="help-block">权限名称长度需在6到64位之间</small> <small
							class="text-warning"
							th:if="${#fields.hasErrors('permissionName')}"
							th:errors="*{permissionName}"></small>
					</div>
				</div>
				<div class="form-group"
					th:classappend="${#fields.hasErrors('permissionUrl')} ? 'has-error'">
					<label for="permissionUrl"
						class="col-lg-2 col-md-2 col-sm-2 hidden-xs control-label">资源路径</label>
					<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12">
						<input type="text" class="form-control input-sm"
							th:field="*{permissionUrl}" maxLength="64" placeHolder="资源路径" />
						<small class="help-block">资源路径长度不能超过128位</small> <small
							class="text-warning"
							th:if="${#fields.hasErrors('permissionUrl')}"
							th:errors="*{permissionUrl}"></small>
					</div>
				</div>
				<div class="form-group">
					<label for="available"
						class="col-lg-2 col-md-2 col-sm-2 hidden-xs control-label">权限有效</label>
					<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12">
						<div class="bootstrap-switch bootstrap-switch-mini"
							data-on-text="有效" data-off-text="禁用">
							<input type="checkbox" th:field="*{available}" />
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
						<input type="submit"
							class="col-lg-offset-3 col-md-offset-3 col-lg-5 col-md-4 col-sm-4 btn btn-lg btn-success"
							value="保存数据" /> <input type="reset"
							class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 btn btn-lg btn-default"
							value="重置" /> <a class="btn btn-lg btn-default" role="button"
							th:href="@{/permissions}">返回列表</a>
					</div>
				</div>
			</fieldset>
		</form>
	</div>
</body>
</html>
